import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import {mapActions,mapGetters} from "vuex";

Vue.config.productionTip = false

//导入iconfont图标
import "./assets/icon/iconfont.css";
//导入封装好的公共sass
import "./assets/scss/com.scss";
//导入animate.css
import "animate.css";

// 注册全局组件
import pageView from "./components/page-view.vue";

Vue.component("page-view", pageView);
import titleBar from "./components/title-bar.vue";

Vue.component("title-bar", titleBar);
import Message from "vue-m-message";
import 'vue-m-message/dist/index.css';

Vue.use(Message, {name: "msg"});
// 二次封装
Vue.prototype.showLoading = text => {
    Vue.prototype.$msg.loading({
        type: "loading",
        title: "光哥点餐",
        message: text,
        collapsable: false,
        duration: -1,
        hasMask: true,
        position: "center"
    });
}

// 左滑的包
import swipeCell from "vue-swipe-cell";
Vue.use(swipeCell);

import Vuerify from "vuerify/dist/vuerify";
Vue.use(Vuerify);

// 全局指令
import Vuelazyload from "vue-lazyload";

Vue.use(Vuelazyload, {
    loading: require("./assets/img/loading.gif"),
    error: require("./assets/img/error.jpg"),
    preload: 1.3,
    attempt: 3
})

// 全局混入：所有的data里面添加一个data
Vue.mixin({
    data() {
        return {
            baseURL: baseURL
        }
    },
    computed:{
        ...mapGetters(["actionSheetConfig"])
    },
    methods:{
        ...mapActions(["showActionSheet","hideActionSheet"])
    }
})

new Vue({
    router,
    store,
    render: h => h(App)
}).$mount('#app')
